#include <stdio.h>
#include <stdlib.h>
#include "utils/utils.c"
#include "watermarking/watermarking.c"
#define NUMARGS 1

int main(int argc, string* argv) {
    if(!check_constraints(argc, argv)) return 0;
    
    //Open watermarked image
    image marked = open_image(argv[1]);
    printf("[%s] Watermarked image's MD5 digest: %s.\n", timestamp(), marked->md5sum);

    //Extract and return watermarking key
    result r = extract(marked);
    printf("[%s] Extracted key is: \"%s\".\n", timestamp(), r.key);
	save_image(r.image);
    printf("[%s] Unwatermarked image's MD5 digest: %s.\n", timestamp(), r.image->md5sum);
    return 0;
}
